fix iteration in source check in error case
authorDebian Qt/KDE Maintainers <debian-qt-kde@lists.debian.org>
Thu, 16 Apr 2020 17:05:12 +0000 (18:05 +0100)
committerDmitry Shachnev <mitya57@debian.org>
Thu, 16 Apr 2020 17:05:12 +0000 (18:05 +0100)
Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=37df81b788ebe700
Last-Update: 2020-04-16

It was accessing the deleted current element in a potentially
reallocated container.

Gbp-Pq: Name qeventdispatcher_glib_use_after_free.diff

src/corelib/kernel/qeventdispatcher_glib.cpp

index 45c6e29e4bebee8fa114633f14644653b9d3eb73..34c2dde6a8f4e9c9974d6a5de663dab06bc93f2b 100644 (file)
@@ -86,9 +86,10 @@ static gboolean socketNotifierSourceCheck(GSource *source)
                      p->pollfd.fd, t[int(p->socketNotifier->type())]);
             // ### note, modifies src->pollfds!
             p->socketNotifier->setEnabled(false);
+            i--;
+        } else {
+            pending = pending || ((p->pollfd.revents & p->pollfd.events) != 0);
         }
-
-        pending = ((p->pollfd.revents & p->pollfd.events) != 0);
     }
 
     return pending;